{% extends 'HuiFrontEndBundle::layout.html.twig' %}

{% block head %}


	<script type="text/javascript">
		$(function () {
	
	        
	        {% if type is defined %}
		        {% if type is constant('\\Hui\\StoreBundle\\Entity\\MayAnh::TYPE_MAY_ANH') %}
			        $('#MayAnh').addClass("active");
			        $('#MayQuay').removeClass("active");
			        $('#KhuyenMai').removeClass("active");
			        $('#TrangChu').removeClass("active");
		        {% elseif type is constant('\\Hui\\StoreBundle\\Entity\\MayQuay::TYPE_MAY_QUAY') %}
			        $('#MayAnh').removeClass("active");
			        $('#MayQuay').addClass("active");
			        $('#KhuyenMai').removeClass("active");
			        $('#TrangChu').removeClass("active");
			    {% elseif type is constant('\\Hui\\FrontendBundle\\Controller\\FrontendController::TYPE_KHUYEN_MAI') %}
				    $('#MayAnh').removeClass("active");
			        $('#MayQuay').removeClass("active");
			        $('#KhuyenMai').addClass("active");
			        $('#TrangChu').removeClass("active");
			    {% else %}
				    $('#MayAnh').removeClass("active");
			        $('#MayQuay').removeClass("active");
			        $('#KhuyenMai').removeClass("active");
			        $('#TrangChu').addClass("active");
		        {% endif %}
	        {% endif %}
	        $('#PhuKien').removeClass("active");
	        $('#SoSanh').removeClass("active");
	        $('#LienHe').removeClass("active");
	        
	    });
	</script>	
    <style type="text/css">
    	.textBoxPaging {
    		width: 50px;
    		height: 25px;
    		text-align: right;
    		-moz-border-radius: 5px;
    		border-radius: 5px;
    	}
    </style>
{% endblock %}

{% block content %}

{% render "HuiFrontEndBundle:Frontend:initMenu" with {'search':1} %}

<div class="grid_18" >
<div>
 <table>
    <tr>
        <td><input type="button" name="btP_First" class="button1" value="|<"/></td>
        <td><input type="button" name="btP_Previous" class="button1" value="<<"/></td>
        <td valign="middle"><input type="text" name="txt_CurrentPage" value="1" maxlength="5" class="textBoxPaging" /></td>
        <td><input type="button" name="btP_Next" class="button1" value=">>"/></td>
        <td><input type="button" name="btP_Last" class="button1" value=">|"/></td>
        <td valign="middle"><label id="lb_DetailPager1" style="color:#65c4ed;font-weight:bold;font-size:small;">Tổng sản phẩm: 0,  0 trong 0 trang</label> </td>
    </tr>
</table>
</div>
<div id="list">

{% for sanPham in sanPhams %}
<hr />
<div class="page1-box2">
	
	{% if type is defined %}
		{% if type == '1' %}
			{% set url = path('hui_front_end_mayanh_chi_tiet',{'id':sanPham.id}) %}
		{% else %}
			{% set url = path('hui_front_end_mayquay_chi_tiet',{'id':sanPham.id}) %}
		{% endif %}
	{% endif %}
	<a href="{{ url }}" class="lightbox-image page4-img2 lightbox-video">
	<img src="{{ asset('bundles/frontend/') }}{{ sanPham.thongTinSanPham.hinhAnh }}" alt="{{ sanPham.thongTinSanPham.tenSp }}" width="90" />
	<span></span></a>
	<div class="link4_else">
	   <a class="link4" href="{{ url }}">{{ sanPham.thongTinSanPham.nhaSanXuat.tenNsx }} {{ sanPham.thongTinSanPham.tenSp }}</a>
	    <p>Giá: {{ sanPham.thongTinSanPham.giaBan|number_format(0,',','.') }} đ</p>
	    {% if sanPham.thongTinSanPham.khuyenMai is not null %}
		    <div class="khuyenmai">
		    <p>{{ sanPham.thongTinSanPham.khuyenMai.loaiKm.tenLoaiKm }}: 
		    	{% if sanPham.thongTinSanPham.khuyenMai.loaiKm.id == '1' %}
					{{ sanPham.thongTinSanPham.khuyenMai.giamGia|number_format(0,',','.') }} đ
				{% else %}
		    		{{ sanPham.thongTinSanPham.khuyenMai.tangPham }}
		    	{% endif %}
		    	
		    	({{ sanPham.thongTinSanPham.khuyenMai.ngayBatDau|date("d/m/Y") }} ~ {{ sanPham.thongTinSanPham.khuyenMai.ngayKetThuc|date("d/m/Y") }})</p>
		    	
		    </div>
		    
	    {% endif %}
	</div>
	<div class="fright p33"> 
{# 		<a id="{{ 'addToCart_'~loop.index }}" class="link5 p34 addToCart">Chọn mua</a>#}
{# 		<input id="{{ 'url_'~loop.index }}" type="hidden" size="5"#}
{# 	                      		value="{{ path('hui_front_end_add_to_cart', {'type':sanPham.thongTinSanPham.loaiSanPham.type, 'id':sanPham.id, 'soLuong':''}) }}" />#}
	<div class="clear"></div>
</div>
{% endfor %}
<hr />

</div>
 <div>
 <table>
    <tr>
        <td><input type="button" name="btP_First" class="button1" value="|<"/></td>
        <td><input type="button" name="btP_Previous" class="button1" value="<<"/></td>
        <td valign="middle"><input type="text" name="txt_CurrentPage" value="1" maxlength="5"  class="textBoxPaging" /></td>
        <td><input type="button" name="btP_Next" class="button1" value=">>"/></td>
        <td><input type="button" name="btP_Last" class="button1" value=">|"/></td>
        <td valign="middle"><label id="lb_DetailPager2" style="color:#65c4ed;font-weight:bold;font-size:small;">Tổng sản phẩm: 0,  0 trong 0 trang</label></td>
    </tr>
</table>
</div>
</div>
<input type="hidden" id ="DPG" value='<%=DPG %>' />
<input type="hidden" id ="LMA" value='<%=LMA %>' />
<input type="hidden" id ="HSX" value='<%=HSX %>' />
<input type="hidden" id ="TEN" value='<%=TEN %>' />


						<div id="dialogSoLuong" title="Nhập số lượng">
                       		<p>Số lượng:</p><input type="text" id="txtSoLuong" size="40" />
                       		<p id="error" style="color: red;"></p>
                       </div>
    					

{% endblock %}
